if(!Array.prototype.indexOf){Array.prototype.indexOf=function(item){for(var i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'");}function htmlUnescape(text){return text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'");}function uncomment(html){var start=html.indexOf("");return html.substr(start,end-start);}function enhanceTextareaData($textareas,config){function merge($data,$textarea){var content="";$("tr",$data).each(function(){if(content.length>0){content+="\n";}$("input,select",$(this)).each(function(){content+=($(this).val()?$(this).val():"")+($(this).attr("glue")?$(this).attr("glue"):"");});});$textarea.val(htmlUnescape(content));}var columnConfigs=config.cols;var captions=config.captions;var onCreateRow=config.onCreateRow;$textareas.each(function(){var $textarea=$(this);var id=$textarea.attr("id");$textarea.hide();var $adder=$('
').appendTo($textarea.parent());var $thead=$adder.find("thead").eq(0);var $tbody=$adder.find("tbody").eq(0);$textarea.parents("form").eq(0).bind("submit",function(){merge($tbody,$textarea);});var htmlHeader="";$.each(columnConfigs,function(index,config){htmlHeader+=''+htmlEscape(config.header)+" | ";});htmlHeader+=''+captions.actions+" |
";$thead.append(htmlHeader);var rows=$textarea.val().split("\n");$.each(rows,function(index,textRow){var htmlRow='';$.each(columnConfigs,function(index,config){var match=textRow.match(config.matcher);var foundMatch=match&&match[1];htmlRow+='';if(config.render){htmlRow+=config.render(foundMatch?match[1]:"");}else{if(config.mapper){htmlRow+='";}else{htmlRow+='';}}htmlRow+=" | ";if(foundMatch){textRow=textRow.substring(match[0].length);}});htmlRow+='';if(captions.add){htmlRow+=''+captions.add+" ";}if(captions.up){htmlRow+=''+captions.up+" ";}if(captions.down){htmlRow+=''+captions.down+" ";}if(captions.del){htmlRow+=''+captions.del+" ";}htmlRow+=" | ";var $row=$(htmlRow).appendTo($tbody);if(onCreateRow){onCreateRow($row);}$(".add",$row).click(function(){var $row=$(this).parents("tr").eq(0);$row.clone(true).attr("id",nextUniqueId()).insertAfter($row).trigger("clearExtras").find("input,select").val("");return false;});$(".up",$row).click(function(){var $row=$(this).parents("tr").eq(0);$row.prev().insertAfter($row);return false;});$(".down",$row).click(function(){var $row=$(this).parents("tr").eq(0);$row.next().insertBefore($row);return false;});$(".del",$row).click(function(){if($("tr",$tbody).length>1){$(this).parents("tr").eq(0).remove();}else{$row.trigger("clearExtras").find("input,select").val("");}return false;});});});}function alreadyExecuted(name){var alreadyExecuted=$("body").data("applied."+name);$("body").data("applied."+name,true);return alreadyExecuted;}function applyAutoInputs(){if(alreadyExecuted("applyAutoInputs")){return;}$("input.auto").each(function(){if(!$(this).attr("value")||$(this).attr("value")==""){$(this).attr("value",$(this).attr("title"));}$(this).focus(function(e){if($(this).attr("value")==$(this).attr("title")){$(this).attr("value","");}});$(this).blur(function(e){if(!$(this).attr("value")||$(this).attr("value")==""){$(this).attr("value",$(this).attr("title"));}});});}function applyOnChangeDropdowns(){if(alreadyExecuted("applyOnChangeDropdowns")){return;}$("select.onChangeDrop").each(function(){$(this).change(function(){$(this).addClass("wait");$(this).blur();$(this).parents("form:first").submit();});});}function applyTextareaCharacterCounter($textarea,defaultMax){$textarea.each(function(){var max=0;var tip=$(this).parents("tr").eq(0).find(".tip:first");if(tip.length){max=$(tip).html().replace(/[^0-9]+/g,"");if(!max){max=defaultMax;}}$(this).after("");$(this).keyup(function(){var value=$(this).val();var copy=new String(value);copy=copy.replace(/\n/g,"\r\n");if(copy.length>max){var crop=copy.substr(0,max);crop=crop.replace(/\r\n/g,"\n");crop=crop.replace(/\r/g,"");$(this).val(value.substr(0,crop.length));}value=$(this).val();var actualLength=value.length+countNewLines(value);$(this).siblings(".remaining").text(actualLength+"/"+max);});});function countNewLines(text){var newLines=text.match(/\n/g);if(newLines){return newLines.length;}else{return 0;}}}function applyMultipleFileUploads(){if(alreadyExecuted("applyMultipleFileUploads")){return;}function increment(elem,attr){var value=$(elem).attr(attr);var index=value.lastIndexOf("-")+1;var count=new Number(value.substring(index));$(elem).attr(attr,value.substring(0,index)+(count+1));}$("table.file").each(function(){var $table=$(this);$("tr.new a.fileAdder",$table).click(function(){var $row=$(this).parents("tr").eq(0);var $newRow=$row.clone(true);$newRow.find("input,select").val("").each(function(){increment(this,"id");increment(this,"name");});$newRow.find("label").val("").each(function(){increment(this,"for");});$(this).hide();if($("tr.new",$table).size()>18){$("a.fileAdder",$newRow).hide();}$newRow.appendTo($table);return false;});});}function applyConfirmation(){if(alreadyExecuted("applyConfirmation")){return;}$("form.needsConfirm").each(function(){var title=$(this).attr("title");$(this).attr("title","");var actionInput=$(this).find("input[name='a']");var action=actionInput.attr("value");var index=action.indexOf(".conf");if(index>0){actionInput.attr("value",action.substring(0,index));}$(this).find("input[type='submit']:not(.cancel)").each(function(){$(this).attr("title",title);}).click(function(){return confirm(title);});});}function applyHover($elem,condition){$elem.each(function(){$(this).bind("mouseover mouseout click",function(e){$tr=$(e.target).is("tr")?$(e.target):$(e.target).parents("tr").eq(0);if($tr.is(condition)){if("mouseover"==e.type){$tr.addClass("hover").addClass("clickable");}if("mouseout"==e.type){$tr.removeClass("hover").removeClass("clickable");}if("click"==e.type&&!$(e.target).is("input")&&!$(e.target).is("a")){$a=$tr.find("a").eq(0);if($a.length&&$a.attr("href")){window.location.href=$a.attr("href");return false;}}}});});}function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else{expires="";}document.cookie=name+"="+value+expires+"; path=/";}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i0){setTimeout(function(){refreshHttpSession(true,millis);},millis);}}}function applySimonWillisonDateParseAndLeaSmartDatePicker(dateformat){if(alreadyExecuted("applySimonWillisonDateParseAndLeaSmartDatePicker")){return;}$("td.date input").each(function(){if(!this.disabled){this.onblur=function(){dp_dateFormat=dateformat;magicDate(this);};this.onfocus=function(){if(this.className!="error"){this.select();}};var calIcon=$("calendar");calIcon.click(function(event){g_Calendar.show(event,this.getAttribute("id"),dateformat);});calIcon.insertAfter(this);calIcon.mouseover(function(event){this.className="calendarIconHover";});calIcon.mouseout(function(event){this.className="calendarIcon";});}});}function toggleView(toggleAreaId,showCaption,hideCaption,collapsed){if(collapsed){$("#"+toggleAreaId).before(''+showCaption+"");$("#"+toggleAreaId).hide();}else{$("#"+toggleAreaId).before(''+hideCaption+"");}$("#"+toggleAreaId+"-toggle").live("click",function(){if($(this).hasClass("hide")){$(this).removeClass("hide").addClass("show").attr("title",showCaption).text(showCaption);}else{$(this).removeClass("show").addClass("hide").attr("title",hideCaption).text(hideCaption);}$("#"+toggleAreaId).slideToggle();return false;});}function applyPopups(){$("a.pop").click(function(){return pop(this,"width=1000, height=750, top=56, left=18, scrollbars, resizable","pop");});}function applyTools(){$("#printButtonTop").click(function(){window.print();return false;});$("#printButtonBottom").click(function(){window.print();return false;});}function applyMainArticleAjax(){var article="#main-content div.main-article";var links="li:not(.series):has(a) > a";var $pagingContainer=$("#main-content ul.home-series-container");var $pagingControls=$("li.series:has(a) > a",$pagingContainer);var $articleLinks=$(links,$pagingContainer);var $items=$("li:not(.series):has(a)","ul.home-series-container");var articleClick=function(){var $parent=$(this).parent("li");var $article=$(article);if($parent.is(".current")||$article.is(":animated")){return false;}$.ajax({url:"article-plain"+$(this).attr("href")+"&for=front",success:function(articleData){$article.fadeOut("fast",function(){$article.html(articleData).fadeIn("fast",function(){$parent.addClass("current").siblings("li").removeClass("current");});});},error:function(){}});return false;};var scroll=function(direction,width){direction=(direction==="left")?"+=":"-=";$("#item-wrapper").animate({marginLeft:direction+width},"fast");};var paginate=function(){var itemWidth=$items.eq(0).css("width");if($(this).parent("li").hasClass("prev")){mainScroller.previous();scroll("left",itemWidth);}else{mainScroller.next();scroll("right",itemWidth);}setupPagingControlsState();return false;};var setupPagingControlsState=function(){$pagingControls.removeClass("inv").hide();mainScroller.hasNext()?$pagingContainer.find("li.next a").show():$pagingContainer.find("li.next a").hide();mainScroller.hasPrevious()?$pagingContainer.find("li.prev a").show():$pagingContainer.find("li.prev a").hide();};var createAndAttachArticles=function(){var startIndex=$articleLinks.length;var lastElement=$pagingContainer.find("li.next");for(var i=startIndex;i").text(enetMainArticles[i].title).attr("href",enetMainArticles[i].url.replace(/&/g,"&")).attr("title",enetMainArticles[i].title);newArticleLink.insertBefore(lastElement).wrap("");}};if(typeof(enetMainArticles)!=="undefined"){var $wrapper=$('');var $scroller=$('');var mainScroller=new EworxEnet.SerialScroller();mainScroller.itemsPerSet=$articleLinks.length;mainScroller.items=new Array(enetMainArticles.length);createAndAttachArticles();setupPagingControlsState();$pagingControls.bind("click",paginate);$articleLinks=$(links,$pagingContainer);$(links,$pagingContainer).parent("li").wrapAll($wrapper);$(links,"ul.home-series-container").click(articleClick);$("#item-wrapper").wrap($scroller);$articleLinks.css("height",$("#item-scroller").height()-parseInt($articleLinks.eq(0).css("padding-top"),10)-parseInt($articleLinks.eq(0).css("padding-bottom"),10));}}function applyGalleryAjax(galleryId){$(function(){$e=$("#"+galleryId).parent("div");if(!$e.hasClass("ajaxApplied")){$e.addClass("ajaxApplied").galleryBox();}});}(function($){$.fn.galleryBox=function(){return this.each(function(){var $obj=$(this);var applied=($.data(this,"events")||{});if(!applied.click){$obj.bind("click",doClick);}function doClick(e){var $target=$(e.target);var c=$target.is("a")&&$target.parent("li")&&($target.parent("li").hasClass("next")||$target.parent("li").hasClass("prev"));if(c){loadAndAnimate($target);e.preventDefault();}}function loadAndAnimate(anchor){var q=anchor.attr("href").substr(anchor.attr("href").indexOf("?"));var req=$.ajax({url:"gallery-plain"+q,success:function(galleryData){var $parent=$obj.parent("div");var heightDiff=$parent.height()-$obj.height();var $temp=$('').html(galleryData).appendTo("body");$parent.css("height",$parent.height());if($temp.find("img").length>0){var loader=new Image();$(loader).bind("load error",function(){$obj.fadeOut("fast",function(){doAnimate($obj,$temp.children(),$temp,heightDiff);});});loader.src=$temp.find("img").eq(0).attr("src");}else{$obj.fadeOut("fast",function(){doAnimate($obj,galleryData,$temp,heightDiff);});}},error:function(){}});}function doAnimate(e,data,loader,heightDiff){e.html(data).parent("div").animate({height:heightDiff+e.height()},function(){e.fadeIn("fast",function(){loader.remove();afterSuccess(e);e.parent("div").css("height","auto");});});}function afterSuccess(e){var links=$("a[rel^=shadowbox]",e);if(links.length){Shadowbox.setup($("a[rel^=shadowbox]",e));}}});};})(jQuery);var EworxEnet={};EworxEnet.SerialScroller=function(elems){this.items=(elems!="undefined")?elems:new Array();this.itemsPerSet=4;this.cIndx=1;this.getItems=function(sIndx){if(sIndx>this.items.length||sIndx<1){return new Array();}this.cIndx=sIndx;return this.items.slice(this.cIndx-1,this.cIndx-1+this.itemsPerSet);};this.hasNext=function(){return this.cIndx<=this.items.length-this.itemsPerSet;};this.hasPrevious=function(){return this.cIndx>1;};this.next=function(){if(this.hasNext()){this.cIndx++;}};this.previous=function(){if(this.hasPrevious()){this.cIndx--;}};};function applyImageTabs(elemSelector){$(elemSelector+" li a").mouseover(function(){var $p=$(this).parent("li");if($p.is(".current")){return;}$p.siblings(".current").removeClass("current");$p.addClass("current");});}function applyTabbedArticles(containerId){var selectedListElementId=$("#"+containerId+" ul.vertical li:first").attr("id");$("#"+containerId+" ul.image-tabs li").children("a").mouseover(function(){var $p=$(this).parent("li");if($p.attr("id")===selectedListElementId){return;}selectedListElementId=$p.attr("id");$("#"+containerId+" ul.image-tabs li").removeClass("current");if($p.parent("ul").hasClass("vertical")){$("#"+containerId+" ul.horizontal li:first").addClass("current");}var $article=$("#"+containerId+" ul.main-article-posts li#"+$p.attr("id"));$article.siblings(".current").removeClass("current").hide();$article.removeClass("inv").addClass("current").show();$p.addClass("current");});$("#"+containerId).mouseleave(function(){$("#"+containerId+" ul.image-tabs li").removeClass("current");$("#"+containerId+" ul.vertical li:first").addClass("current");$("#"+containerId+" ul.horizontal li:first").addClass("current");$("#"+containerId+" ul.main-article-posts").children("li").removeClass("current").hide();$("#"+containerId+" ul.main-article-posts").children("li:first").addClass("current").show();selectedListElementId=$("#"+containerId+" ul.vertical li:first").attr("id");return false;});}function applyGalleryPageInteractions(){$("#gallery-item-container #hide").click(function(){$(this).fadeOut();$("#gallery-item-container #show").removeClass("inv").fadeIn();$("#gallery-item-description").slideUp();return false;});$("#gallery-item-container #show").click(function(){$(this).fadeOut();$("#gallery-item-container #hide").removeClass("inv").fadeIn();$("#gallery-item-description").slideDown();return false;});$("#gallery-item-container .paginatorControl").each(function(){$(this).css("opacity","0.5").show().mouseover(function(){$(this).animate({opacity:1},100);}).mouseout(function(){$(this).animate({opacity:0.5},100);});});}function applyGalleryBoxInteractions(selector){$(selector+" li>a").click(function(){if($(this).parent().hasClass("current")){return false;}$(this).blur().parent().addClass("current").siblings("li").removeClass("current");var q=$(this).attr("href").substr($(this).attr("href").indexOf("?"));var $div=$(this).parents("div").eq(0).find("div.featured-gallery").eq(0);var req=$.ajax({url:"gallery-plain"+q+"&_v="+$(this).attr("rel"),success:function(galleryData){$div.animate({opacity:0},100,function(){$div.html(galleryData);$div.animate({opacity:1},200);});},error:function(){}});return false;});}function executeWelcomeAd(adId,cookieLife){if(!readCookie("ad"+adId)){createCookie("ad"+adId,"1",cookieLife/24);window.location.replace("ad?id="+adId);}}$(function(){$("ul.dropdown>li").hover(function(){$(this).addClass("hover");$(this).parent().find("li.current").addClass("not-current");$(this).parent().find("li.current").removeClass("current");if($(this).parent().hasClass("dropdown")&&!$("ul:first",this).hasClass("on")){$("ul:first",this).css("visibility","visible");$("ul.on",$(this).parent()).css("visibility","hidden");}},function(){$(this).removeClass("hover");$(this).parent().find("li.not-current").addClass("current");$(this).parent().find("li.not-current").removeClass("not-current");if($(this).parent().hasClass("dropdown")&&!$("ul:first",this).hasClass("on")){$("ul:first",this).css("visibility","hidden");$("ul.on",$(this).parent()).css("visibility","visible");}});applyOnChangeDropdowns();applyAutoInputs();applyPopups();applyTools();if($("#header-login").get(0)){$("#header-login").hide().removeClass("inv");$("#header-top-links a.MemberLogin").toggle(function(){$("#header-login").fadeIn().find("input:enabled:first").focus();return false;},function(){$("#header-login").fadeOut();return false;});}});$(window).unload(function(){});